/*
  Name: DeadProxyDatReader.h
  Copyright: 
  Author: Carl Chatfield
  Date: 17/01/08 11:28
  Description: Reads tibia.dat file
*/

#ifndef __DEADPROXYDATREADER_h__
#define __DEADPROXYDATREADER_h__

#ifdef __BORLANDC__
	#pragma hdrstop
#endif

#ifndef WX_PRECOMP
	#include <wx/wx.h>
#else
	#include <wx/wxprec.h>
#endif
#include <stdio.h>
class DatReader// : public wxThread
{
    private:
        wxString * FileName;
    public:
        enum TibiaObjFlags {
            None = 0,
            WalkSpeed = 0x1,
            TopOrder1 = 0x2, //
            TopOrder2 =0x4,
            TopOrder3 =0x8,
            IsContainer = 0x10, // is actually container
            IsStackable = 0x20, //stack was thought to be 0x10 before, its 0x20 though
            IsCorpse = 0x40,
            IsUsable = 0x80,
            IsRune = 0x100, // contains charges?
            IsWritable = 0x200,
            IsReadable = 0x400,
            IsFluidContainer = 0x800, //fluid containers..
            IsSplash = 0x1000,
            IsBlocking = 0x2000, // objects that you cant walk over
            IsImmobile = 0x4000,
            BlocksMissiles = 0x8000, // walls
            BlocksPath = 0x10000,
            IsPickupable = 0x20000, // can this be put into other containers?
            IsHangable = 0x40000,
            IsHangableHorizontal = 0x80000,
            IsHangableVertical = 0x100000,
            IsRotatable = 0x200000,
            IsLightSource = 0x400000,
            FloorChange = 0x800000,
            IsOffset = 0x1000000,
            IsRaised = 0x2000000,
            IsLayer = 0x4000000,
            IsIdleAnimation = 0x8000000,
            HasMiniMapColor = 0x10000000,
            HasHelpLens = 0x20000000,
            IsGround = 0x40000000,
        };
        
        enum TibiaObjLensHelp {
            IsLadder = 0x1,
            IsSewer = 0x2,
            IsDoor = 0x4,
            IsDoorWithLock = 0x8,
            IsRopeSpot = 0x10,
            IsSwitch = 0x20,
            IsStairs = 0x40,
            IsMailbox = 0x80,
            IsDepot = 0x100,
            IsTrash = 0x200,
            IsHole = 0x400,
            HasSpecialDescription = 0x800,
            IsReadOnly = 0x4000,
        };
        
        
        struct ThingData
        {
            unsigned int ThingFlags;
            unsigned int ThingHelpFlags;
            unsigned short Speed;
            unsigned short WriteLimit;
            unsigned short ReadLimit;
            unsigned short LightColor;
            unsigned short LightIntensity;
            unsigned short OffsetX;
            unsigned short OffsetY;
            unsigned short HeightChange;
            unsigned short MiniMapColor;
            unsigned char Width;
            unsigned char Height;
            unsigned char Animations;
            unsigned char BlendFrames;
            unsigned int SpriteCount;
            unsigned char XDiv;
            unsigned char YDiv;
            unsigned char Rare;
            unsigned short * Sprites;
        };
        
        ThingData * ThingInfo;
                    
        void LoadDatFile();
        DatReader(wxString * filename);
};

#endif
